<%@page import="com.eos.common.tool.DataCacheUtil"%>
<%@page import="com.eos.orm.mybatis.model.SysUser"%>
<%@page import="com.eos.orm.mybatis.model.SysCustomer"%>
<%@page import="java.util.List"%>
<%@page contentType="text/html; charset=utf-8"%>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<% 
List<SysCustomer> customerList = (List<SysCustomer>)request.getAttribute("sysCustomerList");
%>
<style>
.page .searchBar label{width:60px;}
</style>
<!-- 此处加action="employeeCtrl.ctrl"是为了条件查询时仍能显示排序图标 -->
<form id="pagerForm" method="post" action="lookUpCustomerList">
	<input type="hidden" name="pageNum" value="${pageNum}" />
	<input type="hidden" name="numPerPage" value="${numPerPage}" />
</form>
<div class="pageHeader">
	<form onsubmit="return dialogSearch(this);" rel="pagerForm" method="post" action="lookUpCustomerList">
		<div class="searchBar">
			<input type="hidden" name="numPerPage" value="${numPerPage}" />
			<input type="hidden" name="pageNum" value="${pageNum}" /> 
			<table class="searchContent">
				<tr>
					<td>
						<label>客户全称：</label>
						<input type="text" size="18" class="txtinput" name="customerName" value="${customerName}" />
					</td>
					<td>
						<label>客户简称：</label>
						<input type="text" size="18" class="txtinput" name="nickName" value="${nickName }" />
					</td>
					<td>
						<label>客户类型：</label>
						<select name="customerType" class="combox">
							<option value="-1" ${customerType == -1 ? "selected='selected'" : "" }>全部</option>
							<option value="1" ${customerType == 1 ? "selected='selected'" : "" }>供应商</option>
							<option value="0" ${customerType == 0 ? "selected='selected'" : ""}  >结算客户</option>
							<option value="2" ${customerType == 2 ? "selected='selected'" : ""} >融信</option>
						</select>
					</td>
					<td>
						<div class="subBar">
							<ul>
								<li>
									<div class="buttonActive">
										<div class="buttonContent">
											<button type="submit">
												检索
											</button>
										</div>
									</div>
								</li>
							</ul>
						</div>
					</td>
				</tr>
			</table>
		</div>
	</form>
</div>
<div class="pageContent">
	<div class="panelBar">
		<ul class="toolBar">
		</ul>
	</div>
	<table class="table" width="100%" layoutH="115">
		<thead>
			<tr>
				<th width="80">
					序号
				</th>
				<th>
					客户ID
				</th>
				<th>
					客户全称
				</th>
				<th>
					客户简称
				</th>
				<th>
					法人代表
				</th>
				<th>
					联系地址
				</th>
				<th >
					邮编
				</th>
				<th>客户类型</th>
				<th>
					所属商务人姓名
				</th>
				<th>
				客户备注
				</th>
				<th>
					联系人
				</th>
			</tr>
		</thead>
		<tbody>
			<% 
				if(null != customerList){
					int i = 1;
					for(SysCustomer c : customerList){
			%> 
				<tr target="sid_customerId" rel="<%=c.getId() %>">
					<td>
						<%=i++ %>
					</td>
					<td><%=c.getId() %></td>
					<td><%=c.getCustomerName() %></td>
					<td><%=c.getCustomerShort() %></td>
					<td><%=c.getLegalPerson() %></td>
					<td><%=c.getCustomerAddress() %></td>
					<td><%=c.getCustomerPostcode() %></td>
					<td>
						<% 
							if(c.getCustomerType().equals("1"))
								out.print("<a style=\"color:#f60;text-decoration: none\">供应商</a>");
							else if(c.getCustomerType().equals("0"))
								out.print("<a style=\"color:#00f;text-decoration: none\">结算客户</a>");
							else if(c.getCustomerType().equals("2"))
								out.print("<a style=\"text-decoration: none\">融信</a>");
						%>
					</td>
					<td>
						<% 
							SysUser u = DataCacheUtil.getSysUser(Integer.parseInt(c.getSysUserId()));
							if(u != null)
								out.print(u.getUserName());
						%>
					</td>
					<td><%=c.getCustomerDesc() %></td>
					<td>
						<a class="btnSelect" href="javascript:$.bringBack({customerId:'<%=c.getId() %>'})" title="查找带回">选择</a>
					</td>
				</tr>
			<%}
			} %>
		</tbody>
	</table>
	<div class="panelBar">
		<div class="pages">
			<span>显示</span>
			<!-- pageNum:1是当更改numPerPage时，使pageNum=1重新开始，否则可能无数据 -->
			<select class="combox" name="numPerPage"
				onchange="navTabPageBreak({numPerPage:this.value, pageNum:1})">
				<option value="15" ${numPerPage==15?'selected':''}>
					15
				</option>
				<option value="20" ${numPerPage==20?'selected':''}>
					20
				</option>
				<option value="25" ${numPerPage==25?'selected':''}>
					25
				</option>
				<option value="50" ${numPerPage==50?'selected':''}>
					50
				</option>
				<option value="100" ${numPerPage==100?'selected':''}>
					100
				</option>
			</select>
			<span>条，共${totalCount }条 </span>
		</div>
		<div class="pagination" targetType="navTab" totalCount="${totalCount }" numPerPage="${numPerPage}" pageNumShown="5" currentPage="${pageNum }"></div>
	</div>
</div>
